### BigQuery connection profile

After installing Elementary's dbt package upon running `dbt deps`,
you can generate Elementary's profile for usage with `edr` by running the following command within your project:

```shell
dbt run-operation elementary.generate_elementary_cli_profile
```

The command will print to the terminal a partially filled template of the profile that's needed for `edr` to work.
[Fill in the missing authentication fields](https://docs.getdbt.com/reference/warehouse-setups/bigquery-setup#authentication-methods)
in the output and copy it to `~/.dbt/profiles.yml`.

The `profiles.yml` file to connect to BigQuery should contain a profile in the following format:

```yml BigQuery
## BIGQUERY ##
## By default, edr expects the profile name 'elementary'.      ##
## Configure the database and schema of elementary models.     ##
## Check where 'elementary_test_results' is to find it.        ##

elementary:
  outputs:
    default:
      type: bigquery

      ## Service account auth, other options require other configs ##
      method: service-account
      keyfile: [full path to your keyfile]

      project: [project id]
      dataset: [dataset name] # elementary dataset, usually [dataset name]_elementary
      threads: 8
      location: [dataset location]
      priority: interactive
```

We support the same format and connection methods as dbt. Please refer to dbt's documentation
of [BigQuery](https://docs.getdbt.com/reference/warehouse-setups/bigquery-setup) for further details.

<Snippet file="dwh/bigquery/cli_service_account.mdx" />

Add the full path of this JSON file to your connection profile under 'keyfile'.
